#!/bin/bash
echo 'begin...'
cd `dirname $0`
BIN_DIR=`pwd`
DEPLOY_DIR=`pwd`
LOGS_DIR=$DEPLOY_DIR/logs
if [ ! -d $LOGS_DIR ]; then
    mkdir $LOGS_DIR
fi
if [ ! -z "$REDIS_HOST" ]; then
    echo "REDIS的HOST:$REDIS_HOST"
    sed -i "s#^spring.redis.host=.*#spring.redis.host=$REDIS_HOST#g" $DEPLOY_DIR/application.properties;
fi
if [ ! -z "$REDIS_PORT" ]; then
    echo "REDIS的PORT:$REDIS_PORT"
    sed -i "s#^spring.redis.port=.*#spring.redis.port=$REDIS_PORT#g" $DEPLOY_DIR/application.properties;
fi
if [ ! -z "$VIPIP" ]; then
    echo "REDIS的PORT:$VIPIP"
    sed -i "s#^tm.socket.vipip=.*#tm.socket.vipip=$VIPIP#g" $DEPLOY_DIR/application.properties;
fi
if [ ! -z "$VIPPORT" ]; then
    echo "REDIS的PORT:$VIPPORT"
    sed -i "s#^tm.socket.vipport=.*#tm.socket.vipport=$VIPPORT#g" $DEPLOY_DIR/application.properties;
fi
echo -e "Starting  ...\c"
java -jar tx-manager-4.1.0.jar